#!/bin/bash
sudo apt-get install -y build-essential
sudo apt-get install -y libtool
sudo apt-get update
sudo apt-get install -y libpcre3 libpcre3-dev
sudo apt-get install -y zlib1g-dev
sudo apt-get install -y openssl
cd /opt
wget http://nginx.org/download/nginx-1.15.0.tar.gz
tar -zxvf nginx-1.15.0.tar.gz
cd nginx-1.15.0
./configure --prefix=/opt/nginx
make
sudo make install
sudo /opt/nginx/sbin/nginx

pnum=$(ps -fe|grep nginx |grep -v grep |wc -l)
if [$pnum >0]
then 
	echo 'nginx 已启动'
	echo '配置软链接'
	sudo ln -s /opt/nginx/sbin/nginx /usr/bin/nginx
fi